package com.imooc.pojo;

import com.baomidou.mybatisplus.annotation.*;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.ToString;

/**
 * 商品图片 
 * 
 * @author yukangkang
 * @email 1304473884@qq.com
 * @date 2021-01-16 21:20:11
 */
@Data
@ToString
@TableName("items_img")
public class ItemsImg implements Serializable {
	private static final long serialVersionUID = 1L;

		/**
		 * 图片主键
		 */
		@TableId(value = ID, type = IdType.AUTO)
		private String id;
		/**
		 * 商品外键id 商品外键id
		 */
		@TableField(ITEM_ID)
		private String itemId;
		/**
		 * 图片地址 图片地址
		 */
		@TableField(URL)
		private String url;
		/**
		 * 顺序 图片顺序，从小到大
		 */
		@TableField(SORT)
		private Integer sort;
		/**
		 * 是否主图 是否主图，1：是，0：否
		 */
		@TableField(IS_MAIN)
		private Integer isMain;
		/**
		 * 创建时间
		 */
		@TableField(CREATED_TIME)
		private Date createdTime;
		/**
		 * 更新时间
		 */
		@TableField(UPDATED_TIME)
		private Date updatedTime;




	public final static String ID =  "`id`";
	public final static String ITEM_ID =  "`item_id`";
	public final static String URL =  "`url`";
	public final static String SORT =  "`sort`";
	public final static String IS_MAIN =  "`is_main`";
	public final static String CREATED_TIME =  "`created_time`";
	public final static String UPDATED_TIME =  "`updated_time`";


	public final static String ID_COMMENT =  "图片主键";
	public final static String ITEM_ID_COMMENT =  "商品外键id 商品外键id";
	public final static String URL_COMMENT =  "图片地址 图片地址";
	public final static String SORT_COMMENT =  "顺序 图片顺序，从小到大";
	public final static String IS_MAIN_COMMENT =  "是否主图 是否主图，1：是，0：否";
	public final static String CREATED_TIME_COMMENT =  "创建时间";
	public final static String UPDATED_TIME_COMMENT =  "更新时间";


	public static ItemsImg of(Object obj) {
		ItemsImg e = new ItemsImg();
		BeanUtils.copyProperties(obj, e);
		return e;
	}

	public static QueryWrapper<ItemsImg> queryWrapper(Object obj) {
		return new QueryWrapper<>(of(obj));
	}



}
